home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group93b.txt / 000074_icon-group-sender _Mon May 10 07:41:56 1993.msg < prev    next >
Internet Message Format  |  1993-06-16  |  6KB

  1. Received: by cheltenham.cs.arizona.edu; Mon, 10 May 1993 07:39:56 MST
  2. Date: 10 May 1993 07:41:56 -0600 (CST)
  3. From: Chris Tenaglia - 257-8765 <TENAGLIA@mis.mcw.edu>
  4. Subject: Icon Tips
  5. To: icon-group@cs.arizona.edu
  6. Message-Id: <01GY03I039EA8WW3GW@mis.mcw.edu>
  7. Organization: Medical College of Wisconsin (Milwaukee, WI)
  8. X-Vms-To: IN%"icon-group@cs.arizona.edu"
  9. Mime-Version: 1.0
  10. Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
  11. Content-Transfer-Encoding: 7BIT
  12. Status: R
  13. Errors-To: icon-group-errors@cs.arizona.edu
  14.  
  15. From:    IN%"MAILER-DAEMON@watserv1.uwaterloo.ca"  "Mail Delivery Subsystem"  9-MAY-1993 00:06:16.42
  16. To:    IN%"walter!xenitec!spectre.uunet.ca!mis.mcw.edu!tenaglia@watserv1.uwaterloo.ca"
  17. Subj:    Returned mail: Service unavailable
  18.  
  19. > I'm going to give my organization a one-hour talk on Icon, with an
  20. > emphasis on using Icon to build prototypes quickly.  Does anyone have
  21. > any suggestions (or religious beliefs) about what should be included
  22. > in such a talk?  Does anyone have a favorite code fragment?  My
  23. > audience is composed of researchers who are proficient Unix hackers,
  24. > so I don't have to pull any punches :-)
  25. > Norman Ramsey
  26. > norman@bellcore.com
  27.  
  28. I like Richard Goerwitz points about the novelty of the language and how
  29. it pushes programming paradigms. I also think speed of development and
  30. prototyping are another super point. I gave a 1 hour talk on it at a DECUS
  31. symposium in Las Vegas in December. I'm not accustomed to speaking so I
  32. think I was rather boring, but the crowd was interested, and that helped.
  33. The only questions I got afterword were 'how do I get this for my system?'.
  34. I think my overheads were pretty good. I brought 20 paper copies of them,
  35. and they nearly all disappeared at the Languages and Tools campground.
  36. Good luck on your endeavor.
  37.  
  38. Here are my favorite fragments :
  39.  
  40. I call | the either-or operator. One use might be like:
  41.          (out := open("OUT.DAT","a") |   #either open for append
  42.          (out := open("OUT.DAT","w") |   #or for write/create
  43.          stop("Can't write to OUT")      #or flag the error
  44.  
  45. I call &random "amper-random" and other variables that begin with &, amper
  46. variables. This helps when speaking about the language without visual aids.
  47. The icon project hasn't said to much about this idea, but I use it, maybe
  48. because the FOCUS language also used around here has amper variables too,
  49. so it's a little more familiar.
  50.  
  51. #
  52. # parse a string into a list with respect to a delimiter
  53. #
  54. procedure parse(line,delims)       # 1p
  55.   static chars
  56.   chars  := &cset -- delims
  57.   tokens := []
  58.   line ? while tab(upto(chars)) do put(tokens,tab(many(chars)))
  59.   return tokens
  60.   end
  61.  
  62. #
  63. # prompt for an input string
  64. #
  65. procedure input(prompt)             # 2p
  66.   writes(prompt)
  67.   return read()
  68.   end
  69.  
  70. #
  71. # converts a linear list into columnated format (like unix ls)
  72. #
  73. procedure cook(lst,cols,width)      # 3p
  74.   local limit,size,array,meal,food,i,j,row,column
  75.   /cols := 5                ; /width := 80
  76.   items := *lst             ; size   := width / cols
  77.   rows  := items / cols + 1 ; limit  := rows * cols
  78.   array := table(" ")       ; meal   := []
  79.   until *lst > limit do put(lst," ")            # push for reverse order
  80.   every column := 1 to cols do
  81.     every row  := 1 to rows do
  82.       array[row||","||column] := pop(lst)       # pull for reverse order
  83.   every row := 1 to rows do
  84.     {
  85.     food := ""
  86.     every column  := 1 to cols do
  87.       food ||:= left(array[row||","||column],size)
  88.     put(meal,trim(food))
  89.     }
  90.   return meal
  91.   end
  92.  
  93. #
  94. # ebcdic/ascii mapping string
  95. #
  96.   ebcdic := "\000\001\002\003\234\011\206\177\227\215\216\013\014\015\016\017"||
  97.             "\020\021\022\023\235\205\010\207\030\031\222\217\034\035\036\037"||
  98.             "\200\201\202\203\204\012\027\033\210\211\212\213\214\005\006\007"||
  99.             "\220\221\026\223\224\225\226\004\230\231\232\233\024\025\236\032"||
  100.             "\040\240\241\242\243\244\245\246\247\250\133\056\074\050\053\041"||
  101.             "\046\251\252\253\254\255\256\257\260\261\135\044\052\051\073\136"||
  102.             "\055\057\262\263\264\265\266\267\270\271\174\054\045\137\076\077"||
  103.             "\272\273\274\275\276\277\300\301\302\140\072\043\100\047\075\042"||
  104.             "\303\141\142\143\144\145\146\147\150\151\304\305\306\307\310\311"||
  105.             "\312\152\153\154\155\156\157\160\161\162\313\314\315\316\317\320"||
  106.             "\321\176\163\164\165\166\167\170\171\172\322\323\324\325\326\327"||
  107.             "\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347"||
  108.             "\173\101\102\103\104\105\106\107\110\111\350\351\352\353\354\355"||
  109.             "\175\112\113\114\115\116\117\120\121\122\356\357\360\361\362\363"||
  110.             "\134\237\123\124\125\126\127\130\131\132\364\365\366\367\370\371"||
  111.             "\060\061\062\063\064\065\066\067\070\071\372\373\374\375\376\377"
  112. #
  113. # formats a input string into an output string using a control string
  114. #            patch("120389","##/##/19##") returns 12/03/1989           
  115. #            patch("12/03/1989","##$")    returns 12                   
  116. #
  117. procedure edit(var,mask)        # 9p  uses string scanning
  118.   text := ""
  119.   var ? {
  120.     every chr := !mask do {
  121.       case chr of {
  122.         "#" : text ||:= move(1)
  123.         "$" : move(1)
  124.         default : text ||:= chr
  125.         }
  126.       }
  127.     }
  128.   return text
  129. end
  130.  
  131. #
  132. # THIS ROUTINE SETS THE CURSOR TO A GIVEN X (COL) Y(ROW) SCREEN LOCATION
  133. #
  134. procedure at(x,y)          # 11p
  135.   return "\e[" || y || ";" || x || "f"
  136.   end
  137.                      
  138. #                                                                #
  139. # FILE : PROGRAM.ICN
  140. # DESC : GENERIC PROGRAM STARTER
  141. #
  142. # UPDATE          BY          WHAT
  143. #
  144. #
  145. procedure main(param)         
  146.   source := param[1]        | input("_Source:")
  147.   target := param[2]        | input("_Target:")
  148.   (in  := open(source))     | stop("Can't open ",source)
  149.   (out := open(target,"w")) | stop("Can't open ",target)
  150.   while line := read(in) do
  151.     {
  152.     }
  153.   close(in) ; close(out)
  154.   end
  155.  
  156. Chris Tenaglia (System Manager) |  "The past explained,     
  157. Medical College of Wisconsin    |   the future fortold, 
  158. 8701 W. Watertown Plank Rd.     |   the present largely appologized for."
  159. Milwaukee, WI 53226             |   Organon to The Doctor
  160. (414)257-8765                   |     
  161. tenaglia@mis.mcw.edu
  162.  
  163.